package com.sf.model;

public enum CollectStatus {
    CREATED((byte)10, "已创建"), FINISHED((byte)20, "完成"), CANCELED((byte)30, "已取消");
    private final Byte code;
    private final String value;

    private CollectStatus(Byte code, String value) {
        this.code = code;
        this.value = value;
    }

    public Byte getCode() {
        return this.code;
    }

    public static CollectStatus getCollectStatusByCode(Byte code) {
        for (CollectStatus collectStatus : CollectStatus.values()) {
            if (collectStatus.getCode().equals(code)) {
                return collectStatus;
            }
        }
        return null;
    }

    public static String getValue(String code) {
        for (CollectStatus collectStatus : CollectStatus.values()) {
            if (collectStatus.getCode().equals(code)) {
                return collectStatus.value;
            }
        }
        return null;
    }
}
